<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<meta name="Author" content="Douglas P Lau"/>
	<link href="nxt_python.css" rel="stylesheet" type="text/css"/>
	<title>NXT Python</title>
</head>

<body>
<h1>NXT_Python</h1>

<h2>About</h2>
<p>
	NXT_Python is a package for controlling a LEGO NXT robot using the
	Python programming language.
	It can communicate using either USB or Bluetooth.
	It is available under the Free Software Foundation's GPL license.
	It was developed on Fedora Core (Linux), but it has been
	reported to work on Windows XP and Mac OS X as well.
	Here's a sample program:
</p>
<pre>
#!/usr/bin/env python

import nxt.locator

sock = nxt.locator.find_one_brick()
if sock:
	brick = sock.connect()
	name, host, signal_strength, user_flash = brick.get_device_info()
	print 'NXT brick name: %s' % name
	print 'Host address: %s' % host
	print 'Bluetooth signal strength: %s' % signal_strength
	print 'Free user flash: %s' % user_flash
	sock.close()
</pre>
<h2>Requirements</h2>
<ul>
	<li><a href='http://www.python.org'>Python 2.4</a></li>
	<li>For Bluetooth communication:
	<ul>
		<li><a href='http://org.csail.mit.edu/pybluez/'>PyBluez</a>
			(Linux or Windows)
		</li>
		<li><a href='http://www.cs.wlu.edu/~levy/software/nxt_lightblue_glue/'>
			NXT Python Lightblue Glue</a> (Mac OS X)
		</li>
	</ul>
	<li>For USB communication:
		<a href='http://sourceforge.net/projects/pyusb/'>PyUSB</a>
	</li>
</ul>
<h2>Download</h2>
<ul>
	<li>Version 0.7<br/>
		&mdash;Added a get_sample() method to CompassSensor class.<br/>
		&mdash;Simplified return values for message_read() method.<br/>
		&mdash;Added message_test.py to examples directory.
	<ul>
		<li><a href='download/nxt_python-0.7.zip'>nxt_python-0.7.zip</a>
			source ZIP archive</li>
		<li><a href='download/nxt_python-0.7.tar.gz'>nxt_python-0.7.tar.gz</a>
			source tarball</li>
	</ul>
	</li>
</ul>
<ul>
	<li>Version 0.6<br/>
		&mdash;Added nxt.compass module for reading Mindsensors
		compass.<br/>
		&mdash;Added optional "host" and "name" arguments to
		find_bricks and find_one_brick methods. This allows multiple
		bricks to be controlled at the same time. (Thanks to Simon
		Levy!)<br/>
		&mdash;Added null-termination to messages for write_message.
	<ul>
		<li><a href='download/nxt_python-0.6.zip'>nxt_python-0.6.zip</a>
			source ZIP archive</li>
		<li><a href='download/nxt_python-0.6.tar.gz'>nxt_python-0.6.tar.gz</a>
			source tarball</li>
	</ul>
	</li>
	<li>Version 0.5 &mdash; Fixed timing problem with USB and Ultrasonic
		sensor
	<ul>
		<li><a href='download/nxt_python-0.5.zip'>nxt_python-0.5.zip</a>
			source ZIP archive</li>
		<li><a href='download/nxt_python-0.5.tar.gz'>nxt_python-0.5.tar.gz</a>
			source tarball</li>
	</ul>
	</li>	
	<li>Version 0.4 &mdash; Improved sensor support + example programs
	<ul>
		<li><a href='download/nxt_python-0.4.zip'>nxt_python-0.4.zip</a>
			source ZIP archive</li>
		<li><a href='download/nxt_python-0.4.tar.gz'>nxt_python-0.4.tar.gz</a>
			source tarball</li>
	</ul>
	</li>	
	<li>Version 0.3 &mdash; Ultrasonic sensor support added
	<ul>
		<li><a href='download/nxt_python-0.3.zip'>nxt_python-0.3.zip</a>
			source ZIP archive</li>
		<li><a href='download/nxt_python-0.3.tar.gz'>nxt_python-0.3.tar.gz</a>
			source tarball</li>
	</ul>
	</li>	
	<li>Version 0.2 &mdash; USB support added
	<ul>
		<li><a href='download/nxt_python-0.2.zip'>nxt_python-0.2.zip</a>
			source ZIP archive</li>
		<li><a href='download/nxt_python-0.2.tar.gz'>nxt_python-0.2.tar.gz</a>
			source tarball</li>
	</ul>
	</li>	
	<li>Version 0.1 &mdash; Initial release
	<ul>
		<li><a href='download/nxt_python-0.1.zip'>nxt_python-0.1.zip</a></li>
		<li><a href='download/nxt_python-0.1.tar.gz'>nxt_python-0.1.tar.gz</a></li>
	</ul>
	</li>	
</ul>

<h2>Installation</h2>
<ul>
	<li>Untar/unzip source package</li>
	<li>In package directory, run "python setup.py install" (as root)</li>
	<li>
		For USB on Linux:
	<ul>
		<li>Create "lego" group, and make your user-id a member</li>
Open a terminal as root, and type:
<pre>groupadd lego</pre>
<pre>usermod -a -G lego [user-id]</pre>
		<li>Create a udev rule</li>
Create file at /etc/udev/rules.d/70-lego.rules, containing one line:
<pre>BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"</pre>
	</ul></li>
</ul>

<h2>Contact</h2>
<p>
	NXT_Python was written by Douglas P Lau.
	See README file in the package for contact information.
</p>
</body>
</html
